<div class="row searchLineWrap">
	<p>
	<% if(hasPrivilegeUrl("download_commission_detail")){ %>
		<a href="javascript:void(0);" onClick="downloaddetail();" class="btn btn-primary pull-left">${_res["system.export"]}</a>
	<% } %>
	<% if(hasPrivilegeUrl("settle_list")){ %>
		<a href="javascript:void(0);" onClick="settle();" class="btn btn-primary pull-left" style="margin-left: 5px">${_res["settlement.operater.settlement"]}</a>
	<% } %>
	<div class="clearfix"></div>
	</p>
	<table class="table table-bordered table-hover">
	    <thead>
	        <tr>
	        	<th><input type="checkbox" id="checkAll" name="checkAll" /></th>
	            <th>${_res["commissionDetail.investor"]}</th>
	            <th>${_res["commissionDetail.related.person"]}</th>
	            <th>${_res["commissionDetail.commsiontype"]}</th>
	            <th>${_res["project.name"]}</th>
	            <th>${_res["commissionDetail.amount"]}</th>
	            <th>${_res["commission.rule.type"]}/${_res["commission.rule.rebate"]}</th>
	            <th>${_res["commissionDetail.status"]}</th>
	            <th>${_res["system.memo"]}</th>
	            <th>${_res["system.operatortime"]}</th>
	          </tr>
	    </thead>
	    <tbody>
	        <%for (commissionDetail in detailList!){%>
	         <tr class="gradeC">
	         	<td><input type="checkbox" name="ids" value="${commissionDetail.id!}" /></td>
	            <td><#cust customerId="${commissionDetail.userid!}"/></td>
	            <td><#cust customerId="${commissionDetail.relatedrPerson!}"/></td>
	            <td><#dict type="lable"  value="${commissionDetail.commissiontype!}"  dictCode="COMMISSION_TYPE" /></td>
	            <td><#dict type="lable" table="project" filedName="projectname" filedValue="id" value="${commissionDetail.projectId!}"/></td>
	            <td><#dict type="lable"  value="${commissionDetail.currency!}" dictCode="CURRENCY" />,${commissionDetail.commission!}</td>
	            <td><#dict type="lable"  value="${commissionDetail.feetype!}"  dictCode="COMMISSION_FEE_TYPE" />/${commissionDetail.rebate!}</td>
	            <td><#dict type="lable"  value="${commissionDetail.status!}"  dictCode="SETTLEMENT_STATUS" /></td>
	            <td>${commissionDetail.memo!}</td>
	            <td>${commissionDetail.createtime!,dateFormat="yyyy-MM-dd HH:mm"}</td>
	       </tr>
	       <%}%>
	    </tbody>
	</table>
</div>

<script>
$(document).ready(function () { 
    $("#checkAll").click(function(event){  
    	$("input[name='ids']").prop('checked',$(this).prop('checked'));
    });  
});  

 function downloaddetail(){
 	var ids = "";
	$("[name='ids']").each(function(){
		ids += $(this).val()+","
	});
	var url = "/admin/commissiondetail/downloadDetail";
	var data = {ids:ids};
	ajaxDownload(url,data);
	return true;
  }
  
function settle(){
	var ids = "";
	var checkedids = "";
	$("[name='ids']").each(function(){
		ids += $(this).val()+","
	  });
	
	$("[name='ids']:checked").each(function(){
		checkedids += $(this).val()+","
	  });
	if(checkedids){
		var url = "/admin/commissiondetail/settlelist";
		var data = {ids:ids,checkedids:checkedids};
		ajaxContentConfirm(url,data);
	}
}  
</script>
 